﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>detail</title>
    <style>
        .upDateBlock{
            width: 300px;
            height: 53px;
            margin:0px auto 15px auto ;
        }
        .upDateTexe{
            width: 280px;
            height:45px;
            padding: 0px 10px;
            font-size: 18px;
            border-radius: 8px;
        }
        .port{
            width: 150px;
            height: 45px;
            margin-left: 75px;
        }
    </style>
    <script src="__PUBLIC__/js/jquery.min.js"></script>
</head>
<body>

    <p align="right" style="padding-right: 20px;">
        <a href="javascript:history.go(-1)">返回上一页</a> 
        <!-- <a onClick="go();" href="#">服务器修改</a> -->
        <a href="{:U('Console/changeInfo')}?chipId={$deviceId}">修改设备信息</a>
        <a href="{:U('Console/changeServer')}?deviceId={$deviceId}">服务器信息修改</a>&nbsp;
        <a href="{:U('User/exitLogin')}">注销</a>
    </p>
    <br/>
    <h1 align="center">楼宇消防监测系统控制平台</h1>
    <br/><br/>
    <h3 align="center" id="deviceadd">{$dAdd}</h3>
    <div id="result" style="text-align: center;">
        <foreach name="info" item="v">
            <p>{$v.id}&nbsp;&nbsp;{$v.time}&nbsp;&nbsp;{$v.ip}&nbsp;&nbsp;{$v.port}&nbsp;&nbsp;{$v.chipid}&nbsp;&nbsp;{$v.devicestate}&nbsp;&nbsp;{$v.deviceadd}</p>
        </foreach>
    </div>
    <div class="search">
        <form>
            <select name="searchTime" id="searchTime">
                <option value="1">三天</option>
                <option value="2">一周</option>
                <option value="3">半个月</option>
                <option value="4">一个月</option>
            </select>
            <button type="button" class="searchButton">查找</button>
        </form>
    </div>
    <hr/>

    <p style="text-align:center;">
        <form  style="text-align:center;" method="post" action="../../../Console.php?id={$id}&f=1">
            <script>
                if("{$dt}" != 1){
                    document.write('');
                }else{
                    document.write('<button type="submit" name="led"  value="LED1">打开</button>&nbsp;&nbsp;'+
                            '<button type="submit" name="led" value="LED0">关闭</button><br/>');
                }
            </script>

        </form>
    </p>
    <div class="foot">
        <p align="center">Copyright © 1996 - 2016 w &amp; c. All Rights Reserved.</p>
        <p align="center">Powered By:lauwen &amp; cc.</p>
    </div>
</body>
<script type="text/javascript">
    $(".searchButton").click(function() {
        /* Act on the event */
        var time = $("#searchTime").val();

        $.ajax({
            url: '{:U("Console/detialSearch")}?chipid={$deviceId}',
            type: 'post',
            dataType: 'json',
            data: {searchTime: time},
            success: function(data){
                console.log('Success');
            }
        })
    });






    /**
     * 弹窗式服务器修改，已关闭
     *
     */
    function create_form_block(title,width,height){
        if (document.getElementById("no") == null) {

//        }
            var serverBlock = document.createElement("div");
            var topBlock = document.createElement("div");
            var topBlockTitle = document.createElement("div");
            var topBlockClose = document.createElement("div");
            var serverInfo = document.createElement("div");

            serverBlock.id = "serverBlock";
            topBlock.id = "topBlock";
            topBlockTitle.id = "topBlockTitle";
            topBlockClose.id = "topBlockClose";
            serverInfo.id = "serverInfo";

            topBlockTitle.innerHTML = title;
            topBlockClose.innerHTML = "<img src='__PUBLIC__/FrontEnd/image/close_button.png' width='50' height='50'>";
            topBlock.appendChild(topBlockTitle);
            topBlock.appendChild(topBlockClose);
            var serverInfoHtml = '<div id="serverDetail">'+
            '<form method="post" action="../../../Console.php?id={$id}&f=0">'+
            '<div class="upDateBlock">'+
            '<input name="updateIp" class="upDateTexe" type="text" placeholder="输入新服务器ip"/>'+
            '</div>'+
            '<div class="upDateBlock">'+
            '<input name="updatePort" class="upDateTexe" type="text" placeholder="输入新服务器端口"/>'+
            '</div>'+
            '<div class="upDateBlock">'+
            '<input name="led" class="port" type="submit" value="修改"/>'+
            '</div>'+
            '</form>'+
            '</div>';

            serverInfo.innerHTML = serverInfoHtml;
            serverBlock.appendChild(topBlock);
            serverBlock.appendChild(serverInfo);

            var topPosition = (document.body.clientHeight - height) / 2;
            var leftPosition = (document.body.clientWidth - width) / 2;
            var serverInfoHeight = height - 70;
            var serverInfoWidth = width - 70;
            var initWidth = width - 20;

            var serverBlockCss = "width:" + width + "px;height:" + height + "px;position:absolute;top:" + topPosition + "px;left:" + leftPosition + "px;background-color:#222222;opacity:1;border-radius:5px;";
            var topBlockCss = "width:" + initWidth + "px;height:70px;padding-left:10px;padding-right:10px;";
            var topBlockTitleCss = "width:" + serverInfoWidth + "px;height:70px;font-size:36px;line-height；70px;color:#eeeeee;float:left;";
            var topBlockCloseCss = "width:50px;height:50px;padding:10px 0px;float:left;";
            var serverInfoCss = "width:" + initWidth + "px;height:" + serverInfoHeight + "px;padding:0px 10px;";

            serverBlock.style.cssText = serverBlockCss;
            topBlock.style.cssText = topBlockCss;
            topBlockTitle.style.cssText = topBlockTitleCss;
            topBlockClose.style.cssText = topBlockCloseCss;
            serverInfo.style.cssText = serverInfoCss;

            topBlockClose.onclick = function () {
                serverBlock.parentNode.removeChild(serverBlock);
            }

            return serverBlock;
        }
    }
    function go(){
        var serverDetail = document.getElementById('serverDetail');
        document.body.appendChild(create_form_block('服务器信息修改',500,300));
    }
</script>
</html>


